package com.example.helloworld;

import android.app.Activity;
import android.app.ProgressDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;

public class ProgressBar extends Activity {

	private static final int PROGRESS_DIALOG =	1001;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_progress_bar);
		
		android.widget.ProgressBar bar =	(android.widget.ProgressBar)findViewById(R.id.progressBar);
		bar .setIndeterminate(false);
		bar.setMax(100);
		bar.setProgress(80);
	}

	public void callDialog(View view) {
		showDialog(PROGRESS_DIALOG);
	}
	
	public Dialog onCreateDialog(int id) {
		switch (id) {
		case (PROGRESS_DIALOG):
			ProgressDialog dialog =	new ProgressDialog(this);
			dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
			dialog.setMessage("data processing...");
			
			return dialog;
		}
		
		return null;
	}
}
